new Vue({
  el: "#app",
  data() {
    return {
      form: {
        News_Type: "0",
      },
      News_Type: [
        {
          value: "0",
          label: "产业技术",
        },
        {
          value: "1",
          label: "文化宣传",
        },
        {
          value: "2",
          label: "产品展示",
        },
        {
          value: "3",
          label: "政策",
        },
        {
          value: "4",
          label: "法规",
        },
      ],
      NewsInfo: "",
    };
  },
  mounted() {
    $("title").text(this.News_Label + "预览");
    let News_SerialNumber = window.sessionStorage.getItem("News_SerialNumber");
    this.SeeDetail(News_SerialNumber);
  },
  computed: {
    News_Label() {
      if (getQueryObject().News_Type) {
        this.form.News_Type = getQueryObject().News_Type;
      }
      let ObjNew_Type = this.News_Type.filter(
        (i) => i.value == this.form.News_Type
      )[0];
      return ObjNew_Type.label;
    },
  },
  methods: {
    SeeDetail(News_SerialNumber) {
      const _this = this;
      let data = {
        Primary_Key_Name: "News_SerialNumber",
        Primary_Key: News_SerialNumber,
        Data: "news_info",
      };
      $.ajax({
        url: DomainName + "/getInquiryIDOriginal?token=" + $.cookie("token"),
        type: "POST",
        data,
        success: function (res) {
          console.log(res);
          _this.NewsTitle = res[0].News_Name;
          _this.NewsInfo = res[0].News_Main;
        },
        // complete: function (XMLHttpRequest) {
        //   _this.loading = false
        //   if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
        //     window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
        //   }
        // }
      });
    },
  },
});
